package com.yeban.base.day05;

import java.util.Arrays;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/9/29
 */
public class TwoArrayTest02 {

    public static void main(String[] args) {

        // 数组初始化1
        char[][] poem1 = {
                {'床','前','明','月','光',','},
                {'疑','是','地','上','霜',','},
                {'举','头','望','明','月',','},
                {'低','头','思','故','乡','。'}
        };
        System.out.println(Arrays.deepToString(poem1));

        char[][] poem2 = new char[6][4];

        for (int i = 0; i < poem1.length; i++) {
            for (int j = 0; j < poem1[i].length; j++) {
                poem2[j][i] = poem1[i][j];
            }
        }

        System.out.println(poem1[1][1]);

        System.out.println("转变前的诗词为：");
        for (int i = 0; i < poem1.length; i++) {
            for (int j = 0; j < poem1[i].length; j++) {
                System.out.print(poem1[i][j]);
            }
            System.out.println();
        }

        System.out.println("\n转变后的诗词为：");
        for (int i = 0; i < poem2.length; i++) {
            for (int j = 0; j < poem2[i].length; j++) {
                System.out.print(poem2[i][poem2[i].length - j - 1]);
            }
            System.out.println();
        }

    }
}
